#!/usr/bin/env bash

set -e -u -x
source ./tasks/helpers.sh
source ./tasks/helpers/lua.sh

task_working_dir

cp "$SOURCE_DIR/test/api-umbrella-test-git-1.rockspec" ./
cp "$SOURCE_DIR/test/luarocks.lock" ./

rm -rf "$TEST_VENDOR_LUA_DIR"

extra_args=("--only-deps")

test_luarocks_install "./api-umbrella-test-git-1.rockspec" "git-1" "${extra_args[@]}"

# Always used cjson bundled with OpenResty, since Luarocks version is older.
"${LUAROCKS_CMD[@]}" --tree="$TEST_VENDOR_LUA_DIR" remove --force "lua-cjson" || true

stamp
